/*
 * Copyright (C), 2014-2015, 杭州小卡科技有限公司
 * FileName: CicpProxy.java
 * Author:   muxing
 * Date:    2015/10/21 15:38
 * Description:
 */
package com.xiaoka.ins.corp.api.cicp.proxy;

import com.xiaoka.ins.corp.api.cicp.stub.NetSalePlatformSoap12BindingStub;

import javax.xml.rpc.ServiceException;

/**
 * CicpProxy
 *
 * @author muxing
 * @date 2015/10/21
 */
public class CicpProxy {

	private CicpProxy() {
	}

	private static com.xiaoka.ins.corp.api.cicp.stub.NetSalePlatformSoap12BindingStub binding = null;

	// 静态工厂方法
	public static NetSalePlatformSoap12BindingStub getInstance() {
		if (binding == null) {
			synchronized (NetSalePlatformSoap12BindingStub.class) {
				if (binding == null) {
					try {
						binding = (NetSalePlatformSoap12BindingStub)
								new com.xiaoka.ins.corp.api.cicp.stub.NetSalePlatformLocator()
										.getNetSalePlatformHttpSoap12Endpoint();
					} catch (ServiceException e) {
						e.printStackTrace();
					}
					// Time out after a minute
					binding.setTimeout(60000);

				}
			}
		}
		return binding;
	}
}
